package com.xdjd.mobile.business.dao.mapper.member;

import com.xdjd.mobile.business.entity.model.member.MemberUserStepPo;
import net.oschina.durcframework.easymybatis.dao.CrudDao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface MemberUserStepPoDao extends CrudDao<MemberUserStepPo> {
    @Update("update member_user_step set today_step_number=#{stepNumber} where member_id=#{memberId}")
    int updateStepNumber(@Param("memberId") Long memberId, @Param("stepNumber") Long stepNumber);

    @Update("update member_user_step set challenge_count=challenge_count+1,is_get=1 where member_id=#{memberId} and is_get=0 and challenge_count<1")
    int addChanceCountLock(@Param("memberId") Long memberId);

    @Update("update member_user_step set challenge_count=challenge_count-1 where member_id=#{memberId} and is_get=1 and challenge_count>0")
    int reduceDefaultChanceCountLock(@Param("memberId") Long memberId);

    @Update("update member_user_step set exchange_challenge_count=exchange_challenge_count-1 where member_id=#{memberId} exchange_challenge_count>0")
    int reduceChanceCountLock(@Param("memberId") Long memberId);
}